from diffusers import AutoPipelineForText2Image
import torch

pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sd-turbo", torch_dtype=torch.float16, variant="fp16")


def generate_image_from_parameters(prompt, width=None, height=None, **kwargs):
    pipe.to("cuda")
    img = pipe(prompt=prompt, width=width, height=height, **kwargs)[0][0]
    pipe.to("cpu")
    return img

prompt = 'A cinematic shot of a baby racoon wearing an intricate italian priest robe.'

img = generate_image_from_parameters(prompt, guidance_scale=0.0, num_inference_steps=1)
img.save('test.png')